<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">委托方销单</li>
    </ol>
    
    <div class="ms-content-layout has-operation">
      
      <form class="form-horizontal ms-form form-personal-info" method="POST" action="${ctx.host}/out-shipments/dispose" data-validate="true">

        <div class="ms-operation-bar no-margin no-bottom-border clearfix">
          <div class="ms-operation-group pull-right">
            <button type="submit" class="btn ms-btn ms-btn-blue"><i class="glyphicon glyphicon-send"></i>&nbsp;&nbsp;销单&nbsp;</button>
          </div> 
        </div>
      
        <input type="hidden" name="_method" value="PATCH"/>
      
        <table class="table table-hover ms-table">
          <thead>
            <tr>
              <th class="dispose-box"><input type="checkbox"></th>
              <th>委托方</th>
              <th>承接方</th>
              <th>最终客户</th>
              <th>调度指令号</th>
              <th>驳运车</th>
              <th>出发地</th>
              <th>目的地</th>
              <th>费用</th>
              <th>单价</th>
              <th>公里数</th>
              <th>车型</th>
              <th>颜色</th>
              <th>VIN码</th>
              <th>是否暂估</th>
            </tr>
          </thead>
          <tbody>
            <c:forEach items="${results}" var="result">
              <tr>
                <td><input type="checkbox" name="financeIds" value="${result.id}"></td>
                <td>${empty result.consignorId ? '' : persist.consignor(result.consignorId).name}</td>
                <td>${empty result.companyId ? '' : persist.organization(result.companyId).name}</td>
                <td>${empty result.customerId ? '' : persist.client(result.customerId).name}</td>
                <td>${result.loadNumber}</td>
                <td>${empty result.transMeansId ? '' : ( persist.vehicle(result.transMeansId).code ).concat( '-' ).concat( persist.vehicle(result.transMeansId).name )}</td>
                <td>${empty result.srcWhId ? '' : ( persist.warehouse(result.srcWhId).code ).concat( '-' ).concat( persist.warehouse(result.srcWhId).name )}</td>
                <td>${empty result.destWhId ? '' : ( persist.warehouse(result.destWhId).code ).concat( '-' ).concat( persist.warehouse(result.destWhId).name )}</td>
                <td><fmt:formatNumber value="${result.fee}" minFractionDigits="2"/></td>
                <td><fmt:formatNumber value="${result.feeRate}" minFractionDigits="2"/></td>
                <td><fmt:formatNumber value="${result.kilometer}" minFractionDigits="2"/></td>
                <td>${empty result.vhCartypeId ? '' : persist.carType(result.vhCartypeId).productCategoryName}</td>
                <td>${empty result.vhColorId ? '' : persist.carColor(result.vhColorId).name}</td>
                <td>${empty result.shipmentId ? '' : persist.vinCode(result.shipmentId)}</td>
                <td>${result.temporary ? "是" : "否"}</td>
              </tr>
            </c:forEach>
          </tbody>
          
          <tfoot>
            <tr>
              <td colspan="15" class="no-vertical-padding">
                <div class="pull-left">
                  <jsp:include page="/WEB-INF/include/page.jsp">
                    <jsp:param name="url" value="${ctx.host}/out-shipments" />
                    <jsp:param name="queryString" value="${queryString}" />
                  </jsp:include>
                </div>
                
                <div class="pull-right">
                  <c:if test="${page.totals > 0}">
                    <a href="${ctx.host}/out-shipments/export-dispose?${queryString}&per_page=${config.everyPage}&page=${page.currentPage}" class="btn btn-default ms-export">输出当前记录</a>
                    <a href="${ctx.host}/out-shipments/export-dispose?${queryString}&per_page=${config.limit}&page=1" class="btn btn-default ms-export">输出所有记录</a>
                  </c:if>
                </div>
              </td>
            </tr>
          </tfoot>
        </table>
      
      </form>
    </div> 
  </div>       
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/business/out-shipment/out-shipment-dispose-list.js" />
  <script type="text/javascript">
      require(['page/business/out-shipment/out-shipment-dispose-list'], function(page) {
          page.init()
      })
  </script>
  
</body>
</html>